/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2009 - 2012 Luca Mingardi.
 *
 * This file is part of jeeObserver.
 *
 * JeeObserver is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * JeeObserver is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
package jeeobserver.server.settings;

import java.util.logging.Level;
import jeeobserver.server.JeeObserverServerContext;

/**
 * The Class LoggerNotification.
 *
 * @author Luca Mingardi
 * @version 4.0
 */
public final class LoggerNotification extends Notification {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 40L;

	/** The level. */
	private final Level level;

	/**
	 * Instantiates a new logger notification.
	 *
	 * @param level the level
	 * @param subject the subject
	 * @param text the text
	 */
	public LoggerNotification(Level level, String subject, String text) {
		super(subject, text);

		this.level = level;
	}

	/**
	 * Instantiates a new logger notification.
	 *
	 * @param subject the subject
	 * @param text the text
	 */
	public LoggerNotification(String subject, String text) {
		super(subject, text);

		this.level = Level.INFO;
	}

	@Override
	public boolean send() {

		JeeObserverServerContext.logger.log(this.level, "**************************************************");
		JeeObserverServerContext.logger.log(this.level, "Subject: {0}", this.getFilledSubject());
		JeeObserverServerContext.logger.log(this.level, this.getFilledText());
		JeeObserverServerContext.logger.log(this.level, "**************************************************");

		return true;
	}
}
